package com.example.myapplication

import com.example.myapplication.pattern.structure.BlackListFilter
import com.example.myapplication.pattern.structure.Internet
import com.example.myapplication.pattern.structure.RouteProxy
import org.junit.Test
import java.lang.reflect.Proxy

class ProxyTest {
    @Test
    fun internetProxy() {
        val internet =
            Proxy.newProxyInstance(
                RouteProxy::class.java.classLoader,
                RouteProxy::class.java.interfaces,
                BlackListFilter(RouteProxy())
            ) as Internet?
        internet?.httpAccess("A")
        internet?.httpAccess("B")
        internet?.httpAccess("D")
    }
}